package com.yjd.user.controll;

import com.yjd.user.entity.User;
import com.yjd.user.restful.service.ILoginRsService;
import com.yjd.user.service.ILoginService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by yangchangyan@yijiedai.com on 2018-12-25 18:33.
 */
@RestController
public class LoginController implements ILoginRsService {

  @Resource
  private ILoginService loginService;

  @Override
  public User login(@PathVariable String username, @PathVariable String password) throws Exception {
    return loginService.login(username, password);
  }

  @Override
  public User login(@RequestBody User user) throws Exception {
    user.setLoginTime(System.currentTimeMillis());
    return user;
  }
}
